<?
define('ROOT',substr(dirname(__FILE__),0,-8));
//测试某目录的写入权限
if(is_array($_FILES))
{
  $cfg_not_allowall = "php|pl|cgi|asp|aspx|jsp|php3|shtm|shtml";
  $keyarr = array('name','type','tmp_name','size');
  foreach($_FILES as $_key=>$_value)
  {
	  foreach($keyarr as $k) {
		  if(!isset($_FILES[$_key][$k])) exit('Request Error!');
	  }
	  $$_key = $_FILES[$_key]['tmp_name'] = str_replace("\\\\","\\",$_FILES[$_key]['tmp_name']);
	  ${$_key.'_name'} = $_FILES[$_key]['name'];
	  ${$_key.'_type'} = $_FILES[$_key]['type'] = eregi_replace('[^0-9a-z\./]','',$_FILES[$_key]['type']);
	  ${$_key.'_size'} = $_FILES[$_key]['size'] = ereg_replace('[^0-9]','',$_FILES[$_key]['size']);
	  if(!empty(${$_key.'_name'}) && (@eregi("\.(".$cfg_not_allowall.")$",${$_key.'_name'}) || !@ereg("\.",${$_key.'_name'})) )
	  {
		   exit('Upload filetype not allow !');
	  }
	  if(empty(${$_key.'_size'})) ${$_key.'_size'} = @filesize($$_key);
  }
}
//文件上传安全检查
function TestWrite($d){
	$tfile = '_hy.txt';
	$fp = @fopen($d.'/'.$tfile,'w');
	if(!$fp) return false;
	else{
		fclose($fp);
		$rs = @unlink($d.'/'.$tfile);
		if($rs) return true;
		else return false;
	}
}

if(isset($_GET[starsetup])){
	echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
  	if(@eregi("[^\.0-9a-z@!_-]",$_POST[adminuser]) || @eregi("[^\.0-9a-z@!_-]",$_POST[adminpwd])){
		exit('<script>alert("管理员用户名或密码含有非法字符"); window.history.back(-1);</script>');
  	}
  	//检测数据库权限
  	$conn = @mysql_connect($_POST[dbhost],$_POST[dbuser],$_POST[dbpwd]);

  	if(!$conn){
		exit('<script>alert("数据库服务器或登录密码无效，无法连接数据库，请重新设定！"); window.history.back(-1);</script>');
  	}
  	$rs = mysql_select_db($_POST[dbname],$conn);
  	if(!$rs){
  		$rs = mysql_query(" CREATE DATABASE `$_POST[dbname]`; ",$conn);
  		if(!$rs){
			exit('<script>alert("数据库 {'.$_POST[dbname].'} 不存在，也没权限创建新的数据库！"); window.history.back(-1);</script>');
  		}else{
  			$rs = mysql_select_db($_POST[dbname],$conn);
  			if(!$rs){
				exit('<script>alert("你对数据库 {'.$_POST[dbname].'} 没权限！"); window.history.back(-1);</script>');
  		  }
  		}
  	}
  	//读取配置模板，并替换真实配置
  	$fp = fopen(ROOT."/install/mysql_config.php","r") or die('<script>alert("读取配置 mysql_config.php 失败，请检查install/mysql_config.php是否可读取！"); window.history.back(-1);</script>');
    $configstr1 = fread($fp,filesize(ROOT."/install/mysql_config.php"));
    fclose($fp);
	
  	$fp = fopen(ROOT."/install/conn.php","r") or die('<script>alert("读取配置 conn.php 失败，请检查install/conn.php是否可读取！"); window.history.back(-1);</script>');
    $configstr2 = fread($fp,filesize(ROOT."/install/conn.php"));
    fclose($fp);
	/*
  	$fp = fopen(ROOT."/install/index_.php","r") or die('<script>alert("读取配置 index_.php 失败，请检查install/index_.php是否可读取！"); window.history.back(-1);</script>');
    $configstr3 = fread($fp,filesize(ROOT."/install/index_.php"));
    fclose($fp);
	*/
    $configstr1 = str_replace('~dbhost~',$_POST[dbhost],$configstr1);
    $configstr1 = str_replace('~dbname~',$_POST[dbname],$configstr1);
    $configstr1 = str_replace('~dbuser~',$_POST[dbuser],$configstr1);
    $configstr1 = str_replace('~dbpwd~',$_POST[dbpwd],$configstr1);
    $configstr1 = str_replace('~dbprefix~',$_POST[dbprefix],$configstr1);
	
  	$fp = fopen(ROOT."/data/mysql_config.php","w") or die('<script>alert("写入配置 data/mysql_config.php 失败，请检查 data文件夹 是否可读写！"); window.history.back(-1);</script>');
  	fwrite($fp,$configstr1);
  	fclose($fp);
	
	$configstr2 = str_replace('~webname~',$_POST[webname],$configstr2);
	
  	$fp = fopen(ROOT."/conn.php","w") or die('<script>alert("写入配置 conn.php 失败，请检查 目录 是否可读写！"); window.history.back(-1);</script>');
  	fwrite($fp,$configstr2);
  	fclose($fp);
  	$fp = fopen(ROOT."/conn_bak.php","w");
  	fwrite($fp,$configstr2);
  	fclose($fp);
	/*
  	$fp = fopen(ROOT."/index.php","w");
  	fwrite($fp,$configstr3);
  	fclose($fp);
	*/
	
  	 //检测数据库信息并创建基本数据表
  	 mysql_query("SET NAMES utf8;",$conn);

     $adminpwd = md5($_POST[adminpwd]);
/*
     $admindatas = "
          INSERT INTO `#@__config` VALUES (7, '网址', '".$_POST[weburl]."',  '');
          INSERT INTO `#@__config` VALUES (22, '安装目录', ''".$_POST[edmspath]."', '');
		  INSERT INTO `#@__config` VALUES (15, 'email地址', ''".$_POST[adminmail]."', '');
          INSERT INTO `#@__admin` VALUES (1, '".$_POST[adminuser]."', '".$adminpwd."', '10');
     ";
	 */
     $fp = fopen(ROOT."/install/mysql.sql","r");
	 
    //创建数据表和写入数据


    $query = "";
    while(!feof($fp))
	  {
		   $line = trim(fgets($fp,1024));
		   if(@ereg(";$",$line)){
			   $query .= $line;
			   $query = str_replace('#@__',$_POST[dbprefix],$query);
			   mysql_query($query,$conn);
			   $query='';
		   }else if(!@ereg("^(//|--)",$line)){
			   $query .= $line;
		   }
	  }
	  fclose($fp);
	  //
		  mysql_close($conn);
		  
	include_once('../conn.php');
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES (7, '网址', '".$_POST[weburl]."',  '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES (22, '安装目录', '".$_POST[edmspath]."', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES (15, 'email地址', '".$_POST[adminmail]."', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('9','价钱四舍五入设置','2','');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('3','价钱模式','3','');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('4','单位','$','');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('5','缩略图模式','0','');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('6','自定义缩略图尺寸','160,160','');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('8','公司名','HoldYes','');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('10','快递','array(\'EMS\',\'圆通\',\'顺丰\',\'DHL\',\'TNT\',\'UPS\',\'FEDEX\',\'其他\');','');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('11','货币位置','0','');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('12','前台语言模板','cn','');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('13','当库存大于此数时显示约摸', '50', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('1','商店模块', 'array(\'zencart\',\'ecshop\');', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('2','支付模块', 'array(\'alipay\',\'paypal\',\'99bill\');', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('14','现在库存', 'array(\'A仓库\',\'B仓库\',\'C仓库\');', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('16','email smtp', 'testmember', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('17','email 密码', 'testmember', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('18','银行信息', '', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('19','信息公告', '', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('20','库存报警数量设置', '1', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('21','管理员等级', 'array(10=>\'超级管理员\',9=>\'商品管理员\',8=>\'财务管理员\',7=>\'订单管理员\');', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('23','订单过期', '2', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('24','商品单位', '件', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('25','合理库存', '3', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('26','应补货', '1', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('27','帮助信息', '', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('28','忘记密码', '', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('29','客户订单', '', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('30','管理员订单', '', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('31','打印页字体大小', '12', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('32','欢迎信息', '<h1>您好&nbsp;{[membername]}&nbsp; 欢迎光临{[companyname]}</h1>
', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('33','客户端每页显现物品数', 'array(\'16\',\'24\',\'48\',\'96\');', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES ('34','按价钱搜索条件', 'array(\'0.01-9.99\',\'10-19.99\',\'20-49.99\',\'50-99.99\',\'100-199.99\',\'200-499.99\',\'&gt;500\');', '');");
	
	
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."admin` VALUES (1, '".$_POST[adminuser]."', '".$adminpwd."', '10');");
	
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."user` VALUES ('4', 'admin', '81dc9bdb52d04dc20036dbd8313ed055', '李大明', '2', '7354.29', '6', '5848939', '100', 'fs.xomdfg', '213123', 'dsfsddfgrgdfg', 'vv_df@dfs.cogfm', '123213', '0', '2011-01-04 09:27:54', '0000-00-00 00:00:00', '1236548', '542620');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."user` VALUES ('5', 'testmember', '91b2316d625405e80ce490601af199d9', 'testmember', '3', '1378.26', '16', '8965158', '36', 'test', '252742324', 'test', '250285246@qq.com', '5345345345345', '0', '2011-02-15 04:16:13', '0000-00-00 00:00:00', '435345', '');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."vip` VALUES ('1', 'VIP LEVEL5', '98', '1', '100');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."vip` VALUES ('2', 'VIP LEVEL4', '95', '2', '100');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."vip` VALUES ('3', 'VIP LEVEL3', '90', '3', '100');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."vip` VALUES ('4', 'VIP LEVEL2', '85', '4', '100');");
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."vip` VALUES ('5', 'VIP LEVEL1', '80', '5', '100');");
	//
		$fp = fopen('install.lock', 'w');
  	  	fwrite($fp,' ');
  	  	fclose($fp);
		
		rename ("./index.php", "./index.php.bak");

	
		 exit('<script>alert("安装成功"); location="../admin_index.php";</script>');
		 // 
	}
/*
if(isset($_GET[insert])){
	include_once('../conn.php');
	$db->INSERT("INSERT INTO `".$_POST[dbprefix]."config` VALUES (7, '网址', '".$_POST[weburl]."',  '');");
	}
*/


?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>分销管理系统</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
	color: #333;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.note{
	width:450px;
	border:#666 dotted 1px;
	padding:20px;
	text-align:center;
	margin:0 auto;
}
-->
</style>
  <script src="include/ajax.js" language="javascript" type="text/javascript"></script>
<script src="include/jquery.js" language="javascript" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
<!--
	$(document).ready(function(){
		//列表第一格CSS
		$(".twbox tr").each(function(){ $(this).children("td").eq(0).addClass("onetd");});
		
		//文本输入框定义CSS+鼠标悬停
		$("input[type='text']").addClass("textipt").mouseover(function(){ $(this).addClass("textipt_on");}).mouseout(function(){$(this).removeClass("textipt_on");});

		//列表行鼠标悬停
		$(".twbox tr").mouseover(function(){ $(this).addClass("moncolor");}).mouseout(function(){$(this).removeClass("moncolor");	});
	});
	function $o(tid){
		return document.getElementById(tid);
	}
	function TestDbPwd()
	{
	  var dbhost = $o('dbhost').value;
		var dbname = $o('dbname').value;
		var dbuser = $o('dbuser').value;
		var dbpwd = $o('dbpwd').value;
		var myajax = new HyAjax($o('dbpwdsta'),false,true,'-','-','...');
    myajax.SendGet2('include/check.php?dbhost='+dbhost+'&dbuser='+dbuser+'&dbname='+dbname+'&dbpwd='+dbpwd);
    HyXHTTP = null;
	}
-->
</script>
</head>

<body>
<div style="background:url(../images/t_bg.gif) repeat-x; height:125px;"><img style="margin-left:10px; float:left;" src="../images/ttfjpg.php?t=分销管理系统&bg=logobg.jpg&z=20&x=5&y=60&r=255&b=255&g=255"  /></div>

<?

	if(file_exists('install.lock')) {
		echo '<div class="note">你已经安装过该系统，如果想重新安装，请先删除install目录的 install.lock 文件，然后再次运行该程序</div>';
		exit;
	}

function install_lock(){
  	  	$fp = fopen('install.lock', 'w');
  	  	fwrite($fp,' ');
  	  	fclose($fp);
  	    $setupinfo = "
	        已完成所有项目的安装<br />
	        现在转入管理员登录页面，请稍等...<br />
	        如果系统太长时间没反应，请点击此<a href='{$gotourl}'>链接&gt;&gt;</a>
	      ";
  	    exit();
	}
//生成install lock
function gdversion()
{ 
  static $gd_version_number = null; 
  if ($gd_version_number === null)
  { 
    ob_start(); 
    phpinfo(8); 
    $module_info = ob_get_contents(); 
    ob_end_clean(); 
    if(preg_match("/\bgd\s+version\b[^\d\n\r]+?([\d\.]+)/i", $module_info,$matches))
    {   $gdversion_h = $matches[1];  }
    else
    {  $gdversion_h = 0; }
  } 
  return $gdversion_h; 
}
//检查gd库

	$phpv = @phpversion();
	$sp_os = strtolower(isset($_ENV['OS']) ? $_ENV['OS'] : @getenv('OS'));
	$sp_gd = @gdversion();
	$sp_server = $_SERVER["SERVER_SOFTWARE"];
	$sp_host = (empty($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_HOST"] : $_SERVER["REMOTE_ADDR"]);
	$sp_name = $_SERVER["SERVER_NAME"];
	$sp_max_execution_time = ini_get('max_execution_time');
	$sp_allow_reference = (ini_get('allow_call_time_pass_reference') ? '<font color=green>[√]On</font>' : '<font color=red>[×]Off</font>');
  $sp_allow_url_fopen = (ini_get('allow_url_fopen') ? '<font color=green>[√]On</font>' : '<font color=red>[×]Off</font>');
  $sp_safe_mode = (ini_get('safe_mode') ? '<font color=red>[×]On</font>' : '<font color=green>[√]Off</font>');
  $sp_gd = ($sp_gd>0 ? '<font color=green>[√]On</font>' : '<font color=red>[×]Off</font>');
  $sp_mysql = (function_exists('mysql_connect') ? '<font color=green>[√]On</font>' : '<font color=red>[×]Off</font>');

  if($sp_mysql=='<font color=red>[×]Off</font>') $sp_mysql_err = true;
  else $sp_mysql_err = false;

  $sp_testdirs = array(
        '/',
        '/include',
        '/data',
        '/module',
        '/session',
        '/upload'
  );
?>	<? if(!isset($_GET[step])){?><table width="500" border="0" align="center" cellpadding="3" cellspacing="3" >
		<tr>
			<th colspan="2" align="left"><img src="../images/ttfjpg.php?t=服务器参数&amp;bg=titlebg2.jpg&amp;z=18&amp;x=0&amp;y=32&amp;r=0&amp;b=0&amp;g=0"  /></th>
	</tr>
		<tr>
				<td width="300"><strong>服务器域名/IP地址</strong></td>
				<td width="424"><?php echo $sp_name."  ".$sp_host; ?></td>
		</tr>
		<tr>
				<td><strong>服务器操作系统</strong></td>
				<td><?php echo $sp_os; ?></td>
		</tr>
		<tr>
				<td><strong>服务器解译引擎</strong></td>
				<td><?php echo $sp_server; ?></td>
		</tr>
		<tr>
				<td><strong>PHP版本</strong></td>
				<td><?php echo $phpv; ?></td>
		</tr>
		<tr>
				<td><strong>安装路径</strong></td>
				<td><?php echo ROOT; ?></td>
		</tr>
		<tr>
				<td><strong>脚本超时时间</strong></td>
				<td><?php echo $sp_max_execution_time; ?> 秒</td>
		</tr>
	</table>
	
  
	
	<table width="500" border="0" align="center" cellpadding="3" cellspacing="3" class="twbox">
		<tr>
		  <th colspan="3" align="left"><img src="../images/ttfjpg.php?t=系统环境要求&amp;bg=titlebg2.jpg&amp;z=18&amp;x=0&amp;y=32&amp;r=0&amp;b=0&amp;g=0"  /></th>
	  </tr>
		<tr>
			<th width="254" align="center"><strong>需开启的变量或函数</strong></th>
			<th width="61"><strong>要求</strong></th>
			<th width="409"><strong>实际状态及建议</strong></th>
		</tr>
		<tr>
		  <td>allow_url_fopen</td>
				<td align="center">On </td>
				<td align="center"><?php echo $sp_allow_url_fopen; ?></td>
		</tr>
		<tr>
		  <td>GD 支持 </td>
				<td align="center">On</td>
				<td align="center"><?php echo $sp_gd; ?></td>
		</tr>
		<tr>
		  <td>MySQL 支持</td>
				<td align="center">On</td>
				<td align="center"><?php echo $sp_mysql; ?></td>
		</tr>
	</table>
    	<table width="500" border="0" align="center" cellpadding="2" cellspacing="2" class="twbox">
		<tr>
		  <th colspan="3" align="left"><img src="../images/ttfjpg.php?t=目录权限检测&amp;bg=titlebg2.jpg&amp;z=18&amp;x=0&amp;y=32&amp;r=0&amp;b=0&amp;g=0" alt=""  /></th>
		  </tr>
		<tr>
			<th width="255" align="center"><strong>目录名</strong></th>
			<th width="66"><strong>要求</strong></th>
			<th width="403"><strong>实际状态及建议</strong></th>
		</tr>
	<?php
	foreach($sp_testdirs as $d)
	{
	  if($d!='/') $fulld = ROOT.$d;
	  else $fulld = ROOT;
	  if($d!='/') $rsta = (is_readable($fulld) ? '<font color=green>[√]读</font>' : '<font color=red>[×]读</font>');
	  else $rsta = '';
	  //$wsta = (is_writeable($fulld) ? '<font color=green>[√]写</font>' : '<font color=red>[×]写</font>');
	  $wsta = (TestWrite($fulld) ? '<font color=green>[√]写</font>' : '<font color=red>[×]写</font>');
	?>
	<tr>
	  <td><?php echo $d; ?></td>
	  <td align="center">读写</td>
	  <td align="center"><?php echo $rsta." ".$wsta; ?></td>
	 </tr>	<?php } ?>
	 <tr>
	   <td colspan="3" align="center">&nbsp;</td>
	   </tr>
	 <tr>
	  <td colspan="3" align="center">	
	<?php if(!$sp_mysql_err){ ?>
	<input type="button" class="nextbut" value="开始安装" onclick="window.location.href='index.php?step=2';" />
	<?php } ?></td>
	  </tr>

</table>
    <? }elseif($_GET[step]=='2'){
		
				if(!empty($_SERVER["REQUEST_URI"])){$scriptName = $_SERVER["REQUEST_URI"]; }
  else{ $scriptName = $_SERVER["PHP_SELF"]; }
  $edmspath = @ereg_replace("/install/index\.php(.*)$","",$scriptName);
  if(empty($_SERVER['HTTP_HOST'])) $baseurl = "http://".$_SERVER['HTTP_HOST'];
  else $baseurl = "http://".$_SERVER['SERVER_NAME'];
  $rnd_cookieEncode = chr(mt_rand(ord('A'),ord('Z'))).chr(mt_rand(ord('a'),ord('z'))).chr(mt_rand(ord('A'),ord('Z'))).chr(mt_rand(ord('A'),ord('Z'))).chr(mt_rand(ord('a'),ord('z'))).mt_rand(1000,9999).chr(mt_rand(ord('A'),ord('Z')));
		?>
  
<form  method="post" name="form1" action="?starsetup">
  <table width="600" border="0" align="center" cellpadding="2" cellspacing="2" class="twbox">
		
		<tr>
		  <td colspan="2"><img src="../images/ttfjpg.php?t=数据库设定&amp;bg=titlebg2.jpg&amp;z=18&amp;x=0&amp;y=32&amp;r=0&amp;b=0&amp;g=0" alt=""  /></td>
	    </tr>
		<tr>
			<td width="112"><strong>数据库主机：</strong></td>
			<td width="474"><input name="dbhost" type="text" id="dbhost" value="localhost" style="width:200px" />
			一般为localhost</td>
		</tr>
		<tr>
			<td><strong>数据库名称：</strong></td>
			<td>
				<input name="dbname" type="text" id="dbname" value="" style="width:200px" />
			</td>
		</tr>
		<tr>
			<td><strong>数据库用户：</strong></td>
			<td><input name="dbuser" type="text" id="dbuser" value="root" style="width:150px" /></td>
		</tr>
		<tr>
			<td><strong>数据库密码：</strong></td>
			<td>
			<input name="dbpwd" type="text" id="dbpwd" style="width:150px" onchange="TestDbPwd()" />
			<span id='dbpwdsta'></span>
			</td>
		</tr>
		<tr>
			<td><strong>数据表前缀：</strong></td>
			<td><input name="dbprefix" type="text" id="dbprefix" value="hy_" style="width:200px" />
					如无特殊需要,请不要修改</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>
				  本选项仅适用于MySql 5及更高版本
			</td>
		</tr>

</table>
      	<table width="600" border="0" align="center" cellpadding="2" cellspacing="2" class="twbox">
		
		<tr>
		  <td colspan="2"><img src="../images/ttfjpg.php?t=管理员初始密码&amp;bg=titlebg2.jpg&amp;z=18&amp;x=0&amp;y=32&amp;r=0&amp;b=0&amp;g=0" alt=""  /></td>
		  </tr>
		<tr>
			<td width="114"><strong>用户名：</strong></td>
			<td width="472">
				<input name="adminuser" type="text" id="adminuser" value="admin" style="width:200px" />
				<p>只能用'0-9'、'a-z'、'A-Z'、'.'、'@'、'_'、'-'、'!'以内范围的字符</p>
			</td>
		</tr>
		<tr>
			<td><strong>密　码：</strong></td>
			<td><input name="adminpwd" type="text" id="adminpwd" value="admin" style="width:200px" /></td>
		</tr>
		<tr>
			<td><strong>Cookie加密码：</strong></td>
			<td><input name="cookiepwd" type="text" id="cookiepwd" value="<?php echo $rnd_cookieEncode; ?>" style="width:200px" /></td>
		</tr>
	</table>
   	<table width="600" border="0" align="center" cellpadding="2" cellspacing="2" class="twbox">
		
	  <tr>
    <td colspan="2"><img src="../images/ttfjpg.php?t=其他设置&amp;bg=titlebg2.jpg&amp;z=18&amp;x=0&amp;y=32&amp;r=0&amp;b=0&amp;g=0" alt=""  /></td>
	  </tr>
	  <tr>
		  <td width="115"><strong>网站名称：</strong></td>
		  <td width="471">
			  <input name="webname" type="text" id="webname" value="濠逸分销管理系统" style="width:200px" />
		  </td>
	  </tr>
	  <tr>
		  <td><strong>管理员邮箱：</strong></td>
		  <td><input name="adminmail" type="text" id="adminmail" value="admin@yourmail.com" style="width:200px" /></td>
	  </tr>
	  <tr>
		  <td><strong> 网站网址：</strong></td>
		  <td><input name="weburl" type="text" value="<?php echo $baseurl; ?>" id="weburl" style="width:200px" /></td>
	  </tr>
	  <tr>
		  <td><strong>系统安装目录：</strong></td>
		  <td><input name="edmspath" type="text" value="<?php echo $edmspath; ?>" id="edmspath" style="width:200px" />
		 在根目录安装时不必理会</td>
	  </tr>
	  <tr>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
      </tr>
	  <tr>
	    <td colspan="2" align="center"><input type="button" class="backbut" value="返回" onclick="history.back();" style="margin-right:20px" />
	<input name="提交" type="submit" class="setupbut" value="安装" /></td>
      </tr>
  </table>
</form>
<? }?>
</body>
</html>
